package com.lotus.lqmp.service.common.convert;

import com.lotus.lqmp.service.common.config.MappingConfig;
import com.lotus.lqmp.service.controller.vo.resp.ReviewPlanDeletedQueryResp;
import com.lotus.lqmp.service.controller.vo.resp.ReviewPlanQueryResp;
import com.lotus.lqmp.service.domain.ReviewPlanDeletedQueryDomain;
import com.lotus.lqmp.service.domain.ReviewPlanQueryDomain;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * @author hejun
 * @description: 实体转换
 * @date 2021/10/6 11:31
 */
@Mapper(config = MappingConfig.class)
public interface ReviewPlanConvert {

    /**
     * do 集合 转换 前端相应实体 集合
     * @param reviewPlanQueryDomainList do集合信息
     * @return
     */
    List<ReviewPlanQueryResp> domains2Resps(List<ReviewPlanQueryDomain> reviewPlanQueryDomainList);

    /**
     * do 转换 前端相应实体
     * @param reviewPlanQueryDomain
     * @return
     */
    ReviewPlanQueryResp domainsResps(ReviewPlanQueryDomain reviewPlanQueryDomain);

    /**
     * do 集合 转换 前端相应实体 集合
     * @param deletedQueryDomains do集合信息
     * @return
     */
    List<ReviewPlanDeletedQueryResp> deletedDomains2Resp(List<ReviewPlanDeletedQueryDomain> deletedQueryDomains);

    /**
     * do 转换 前端相应实体
     * @param deletedQueryDomain
     * @return
     */
    @Mappings({
        @Mapping(target = "deletedTime", expression = "java(com.lotus.lqmp.service.common.utils.CommonUtil.covert2TimeStamp(deletedQueryDomain.getDeletedTime()))"),
        @Mapping(ignore = true, target = "creator"),
        @Mapping(ignore = true, target = "editor")
    })
    ReviewPlanDeletedQueryResp deletedDomainsResp(ReviewPlanDeletedQueryDomain deletedQueryDomain);

}
